package com.xdtech.sys.service;

import java.util.List;
import java.util.Map;

import com.xdtech.common.service.IBaseService;
import com.xdtech.sys.model.MenuFunction;
import com.xdtech.sys.model.User;
import com.xdtech.sys.searchers.UserCondition;
import com.xdtech.sys.vo.RoleItem;
import com.xdtech.sys.vo.UserItem;
import com.xdtech.web.model.Pagination;

public interface UserService extends IBaseService<User> {
	
	public User getUserByName(String loginName);
	/**
	 * 加载用户权限信息
	 * @param userId
	 * @return
	 */
	public List<MenuFunction> loadUserFunctions(Long userId,List<Long> roleIds);
	/**
	 * 加载用户对应的角色
	 * @param userId
	 * @return
	 */
	public List<RoleItem> loadUserRoles(Long userId);
	/**
	 * 加载分页数据
	 * @param pg
	 * @param groupId
	 * @return
	 */
	public Map<String, Object> loadPageDatas(Pagination pg,Long groupId);
	
	public boolean deleteUserLinkInfo(long id);
	
	public boolean saveOrUpdateUser(UserItem user);
	
	public UserItem loadUserItem(long id);
	
	public List<User> loadByCondition(Map<String, String> conditions);
	
	/**
	 * 
	 * @param pg
	 * @param userCondition
	 * @return
	 */
	public Map<String, Object> loadDataByCondition(Pagination pg,UserCondition userCondition);
	/**
	 * 
	 * @description 更新用户密码
	 * @author
	 * @create 2014-8-6下午10:12:47
	 * @modified by
	 * @param userId
	 * @param newPwd
	 * @return
	 */
	public boolean updateUserPwd(Long userId,String newPwd);
	/**
	 * 
	 * @author max.zheng
	 * @create 2014-11-30下午12:26:12
	 * @modified by
	 * @param newIds
	 */
	public boolean deleteUserInfo(List<Long> userIds);
	/**
	 * 
	 * @author <a href="max.zheng@zkteco.com">郑志雄</>
	 * @since 2015-1-30 下午1:46:44
	 * @param userIds
	 */
	public void disableUserByIds(List<Long> userIds);
	/**
	 * 启用用户
	 * @author <a href="max.zheng@zkteco.com">郑志雄</>
	 * @since 2015-2-3 上午11:02:14
	 * @param userIds
	 */
	public void enableUserByIds(List<Long> userIds);
	/**
	 * 加载所有用户
	 * @author <a href="max.zheng@zkteco.com">郑志雄</>
	 * @since 2015-3-24 下午2:46:01
	 * @return
	 */
	public List<UserItem> loadAllUserItem();
	/**
	 * 根据id获取用户密码
	 * @author max.zheng
	 * @create 2015-4-12下午10:01:25
	 * @modified by
	 * @param id
	 * @return
	 */
	public String getUserPwdById(Long id);
	/**
	 * 检测用户登录名是否存在
	 * @author max.zheng
	 * @create 2015-5-31下午10:26:19
	 * @modified by
	 * @param name
	 * @return true 存在 false 不存在
	 */
	public boolean checkUserNameIsExist(Long userId,String name);
	/**
	 * 
	 * @author max.zheng
	 * @create 2015-7-4下午11:25:07
	 * @modified by
	 * @param username
	 * @param password
	 * @return
	 */
	public UserItem getUserWithNameAndPwd(String username, String password);
	/**
	 * 根据登录名判断是否是超级用户
	 * @author max.zheng
	 * @create 2015-7-25下午5:06:55
	 * @modified by
	 * @param loginName
	 * @return
	 */
	public boolean getIsSuperuser(String loginName);
}
